#include <stdio.h>
int main(void)    
{    
       int found, i, k, n;
       int a[10][10];

       scanf ("%d", &n);
       for (i = 0; i < n; i++)    
           for (k = 0; k < n; k++)
            scanf("%d", &a[i][k]);

     found = 1;
       for (i = 0; i < n; i++){    
           for (k = 0; k < i; k++){
               if (
a[i][k]!=a[k][i]
) {    
                
found=0
;          
                           break;
                            }
        }
        if (
found==0
){
            break;
           }
      }

      if (found != 0){
          printf("Yes\n");
      }  
      else{
          printf("No\n");
      }  

    return 0;
}